package me.idashu.attg.service;

import java.util.List;
import java.util.Map;

import me.idashu.attg.domain.UserEntity;
import me.idashu.attg.persistence.UserMapper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

	@Autowired
	private UserMapper userMapper;
	
	public void registerUser(UserEntity userEntity){
		userMapper.registerUser(userEntity);
	}
	
	public UserEntity findUserByUserNameAndPassWord(UserEntity userEntity){
		UserEntity user = userMapper.findUserByUserNameAndPassWord(userEntity);
		return user;
	}
	
	public UserEntity findUserByUserName(UserEntity userEntity){
		UserEntity user = userMapper.findUserByUserName(userEntity);
		return user;
	}
	
	public List<UserEntity> findUsersByPage(Map<String, Object> map){
		List<UserEntity> users = userMapper.findUsersByPage(map);
		return users;
	}
	
	public int findCountUsersByPage(UserEntity userEntity){
		int count = userMapper.findCountUsersByPage(userEntity);
		return count;
	}
}
